package com.zhaosoft;

import java.util.Random;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.Poller;
import org.springframework.integration.core.MessageSource;
import org.springframework.messaging.support.GenericMessage;

@EnableBinding(value = { Source.class })
public class SinkSender2 {

	private static Logger logger = LoggerFactory.getLogger(SinkSender2.class);

	
	@Bean
	@InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "2000") )
	public MessageSource<String> timerMessageSource() {
		Integer id=new Random().nextInt();
		return () -> new GenericMessage<>("{\"id\":"+id+",\"name\":\"zxl \",\"age\":30}") ;
	}

}
